/**
* 
* Sonde system specific sonde for sheduler 
* Copyright (c) 2009 Ecole Centrale de Nantes IRCCyN  
* 
* see <a href="{@docRoot}/Documentation/sonde.html"> for more information</a>
* 
* @author: Urunuela Richard
* @version 3.2
*/
package report;

import java.awt.Color;
import java.util.StringTokenizer;

import java.lang.reflect.*;


import programme.GUI.JConsole;
import storm.Schedulers.Scheduler;

public class scheduler extends sonde {

	
	private Scheduler sched;

	/**
	 * 
	 * @param oo
	 * @param s
	 */
	public scheduler(output oo,storm.Schedulers.Scheduler s) {
		super(oo);
		this.sched = s;
		this.theOutPut.appendSection("Scheduler");
		// TODO Auto-generated constructor stub
	}
	/**
	 * Parse specific command
	 */
	public boolean parse(String s){
		return super.parse(s);
	}
	/**
	 * that internal own field
	 */
	public void internalData(String commande) {
		if (commande.compareToIgnoreCase("name")==0){
			this.theOutPut.addligne(commande + ":" + this.sched.getName());
			
		}
		if (commande.compareToIgnoreCase("classname")==0){
			Class classe = sched.getClass();
			this.theOutPut.addligne(commande + ":" + classe);
		}
	}
/**
 *  that specific own  field not in superclass of scheduler but in own sheduler (for example quantum)
 *  attribut ajouter dans specialisation 
 */
	
	public void externalData(String commande) {
		commande = commande.trim();
		Class classe = sched.getClass();
	    Field attribut;
		try {
			attribut = classe.getDeclaredField(commande);
		    Object valeur = attribut.get(sched);
			this.theOutPut.addligne(commande + ":" + valeur );
		
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  catch (NoSuchFieldException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
}
